package com.esyoga.yoyoga.service.impl;

import com.esyoga.yoyoga.mapper.TStudentMapper;
import com.esyoga.yoyoga.pojo.TStudent;
import com.esyoga.yoyoga.pojo.TStudentExample;
import com.esyoga.yoyoga.service.StudentDataService;
import lombok.Data;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Data
@Service
public class StudentDataServiceImpl implements StudentDataService {
    @Resource
    TStudentMapper tStudentMapper;

    //修改个人信息
    @Override
    public int updateData(Integer sId,TStudent tStudent) {
        tStudent.setsId(sId);
        TStudentExample example = new TStudentExample();
        TStudentExample.Criteria criteria = example.createCriteria();
        criteria.andSIdEqualTo(sId);
        return tStudentMapper.updateByPrimaryKeySelective(tStudent);
    }
    //查询个人信息
    @Override
    public List<TStudent> showData(Integer sId) {
        TStudentExample example = new TStudentExample();
        TStudentExample.Criteria criteria = example.createCriteria();
        criteria.andSIdEqualTo(sId);
        return tStudentMapper.selectByExample(example);
    }
}
